/**
 *
 */
package jp.seraph.same.view.cui;

import jp.seraph.cui.AbstractCommand;
import jp.seraph.cui.Command;
import jp.seraph.cui.InternalConsole;
import jp.seraph.cui.Mode;
import jp.seraph.cui.SystemNode;
import jp.seraph.cui.SystemNodeType;
import jp.seraph.jspf.utils.PoseUtil;
import jp.seraph.same.controller.AgentController;

/**
 *
 *
 */
public class RunPoseCommand extends AbstractCommand implements Command {
    public RunPoseCommand(AgentController aController, Mode aParent, InternalConsole aConsole){
        super(aParent, aConsole);

        mController = aController;
    }

    private AgentController mController;

    /**
     *
     * @see jp.seraph.cui.AbstractCommand#executeImpl(jp.seraph.cui.SystemNode[], int)
     */
    @Override
    protected void executeImpl(SystemNode[] aArgs, int aArgListIndex) {
        PoseData tData = (PoseData)aArgs[0];
        mController.apply(PoseUtil.createPoseSet(tData.getPoseModel().toPose()));
    }

    /**
     *
     * @see jp.seraph.cui.Command#getArgumentTypes()
     */
    public SystemNodeType[][] getArgumentTypes() {
        SystemNodeType[][] tResult = new PoseDataType[1][];
        tResult[0] = new PoseDataType[]{PoseDataType.getInstance()};

        return tResult;
    }

    /**
     *
     * @see jp.seraph.cui.Command#getHelp()
     */
    public String getHelp() {
        return "run PoseData";
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getName()
     */
    public String getName() {
        return "run";
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getType()
     */
    public SystemNodeType getType() {
        return RunPoseCommandType.getInstance();
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#isRoot()
     */
    public boolean isRoot() {
        return false;
    }
}
